#include "App.h"
#ifdef WIN32
#include "MemoryOperators.h"
#endif
App* App::single = 0;
bool App::AddMouseDown()
{
	return m_stroke.AddMouseDown();
}
bool App::AddMouseMove(int x, int y)
{
	return m_stroke.AddMouseMove(x, y);
}

bool App::AddMouseUp()
{
	return m_stroke.AddMouseUp();
}

void App::PrintPoint()
{
	//m_stroke.PrintPoint();
	m_multiClassDigit.ReadData("mit", 10, 100, 12, 3.2, 2, "dataDigit.bin");
	m_multiClassDigit.TrainData("svmDataDigit.bin");
}

void App::LoadData()
{
	//m_multiClassDigit.LoadData("dataDigit.bin");
	//m_multiClassDigit.LoadSVMParameter("svmDataDigit.bin");
	m_multiClassDigit.LoadAllData("dataDigit.bin", "svmDataDigit.bin");
}
int App::Recognize()
{
	int n = 10;
	float *p = m_stroke.featureExtraction(n);
	int iClass = m_multiClassDigit.Classify(p, 2 * n);
	return iClass;
}
void App::FreeMemory()
{
	m_multiClassDigit.FreeMemory();
	delete[] single; single = 0;
}
